﻿using System.Drawing;
using OfficeOpenXml;
using OfficeOpenXml.Style;

namespace 请求响应加密.attr
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public class ExcelCellAttribute : Attribute
    { 
        public string CellName { get; set; }

        #region 字体相关属性

        public string FontName { get; set; }
        public int FontSize { get; set; }
        public bool FontBold { get; set; }
        public bool FontItalic { get; set; }
        public string FontColor { get; set; }
        public bool UnderLine { get; set; }

        #endregion

        #region 单元格样式

        public int Indent { get; set; }
        public bool WrapText { get; set; }
        public int TextRotation { get; set; }
        public string BorderStyle { get; set; }  // ExcelBorderStyle: Thin,Dashed
        public string Border {  get; set; }      // 0 1 0 1 左上右下
        public string BackgroundStyle { get; set; }    // Solid,Gradient
        public string BackgroundColor { get; set; }
        /// <summary>
        /// 是否允许对该列做跨行合并相同值（默认 false）
        /// </summary>
        public bool MergeSameCells { get; set; }
        #endregion


        public ExcelCellAttribute(string cellName,
            string fontName = "微软雅黑",
            int fontSize = 12,
            bool fontBold = false,
            bool fontItalic = false,
            string fontColor = "Black",
            bool underline = false,
            int indent = 1,
            bool wrapText = false,
            int textRotation = 0,
            string borderStyle = "Thin",
            string border = "0,0,0,0",
            string backgroundStyle = "Solid",
            string backgroundColor = "White",
            bool mergeSameCells = false
            )
        {
            CellName = cellName;
            FontName = fontName;
            FontSize = fontSize;
            FontBold = fontBold;
            FontItalic = fontItalic;
            FontColor = fontColor;
            UnderLine = underline;
            Indent = indent;
            WrapText = wrapText;
            TextRotation = textRotation;
            BorderStyle = borderStyle;
            Border = border;
            BackgroundStyle = backgroundStyle;
            BackgroundColor = backgroundColor;
            MergeSameCells = mergeSameCells;
        }
    }
}
